//
//  main.m
//  Objective-C HomeWork 03 - NSString NSArray NSMutableArray
//
//  Created by dllo on 16/7/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Book.h"
#import "BookManager.h"
int main(int argc, const char * argv[]) {
    /*
     1.截取字符串 "20|https://www.baidu.com" 中 "|" 前面和后⾯的字符串, 并输出
     2.向可变数组里存储 int、float、double、BOOL类型等数据(不能使用字面量)
     3.实现图书管理系统(BookManager类)：
     使用数组管理所有书籍(Book类)。
     BookManager类属性数组可以添加、删除。
     可以从数组根据书名查找书籍，并修改书籍的价格。
     展示所有书籍清单（书名）
     **/
    NSString *str = @"20|https://www.baidu.com";
    NSArray *strArray = [str componentsSeparatedByString:@"|"];
    NSLog(@"strArray = %@",strArray);
    
    int a = 1;
    NSNumber *numberOfA = [NSNumber numberWithInt:a];
    float b = 2.0;
    NSNumber *numberOfB = [NSNumber numberWithFloat:b];
    double c = 2.0000;
    NSNumber *numberOfC = [NSNumber numberWithDouble:c];
    BOOL d = YES;
    NSNumber *numberOfD = [NSNumber numberWithBool:d];
    NSMutableArray *numberArray = [NSMutableArray arrayWithObjects:  numberOfA, numberOfB, numberOfC, numberOfD, nil];
    NSLog(@"numberArray = %@",numberArray);
    
    Book *book1 = [Book bookWithBookName:@"大学计算机基础" bookPrice:60];
    Book *book2 = [Book bookWithBookName:@"高等数学" bookPrice:66];
    Book *book3 = [Book bookWithBookName:@"大学英语" bookPrice:88];
    NSMutableArray *bookArray = [NSMutableArray array];
    BookManager *bookManager = [BookManager bookManagerWithBookArray:bookArray];
    [bookManager addBook:book1];
    [bookManager addBook:book2];
    [bookManager addBook:book3];
    [bookManager disPlay];
    
    [bookManager deleteBook:book3];
    [bookManager disPlay];
    return 0;
}
